// @047

package jtk.project4.fleet.field;

import javax.swing.SortOrder;

import jtk.project4.fleet.domain.Equipment;
import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.TableField;
import nl.coderight.jazz.form.field.TableField.AutoResizeMode;

public class BrowsePurchaseOrdersField extends GroupControl<String> {
	
	private TableField<String> browsePurcaseOrdersTable;
	public BrowsePurchaseOrdersField(String bindID){
		setTitle("header.BrowsePurcaseOrders");
		setBindID(bindID);
		createFields();
		createLayout();
	}
	
	private void createFields(){
		//setup table
		browsePurcaseOrdersTable = new TableField<String>("BrowsePurcaseOrders","BrowsePurcaseOrders");
		browsePurcaseOrdersTable.setTitle("BrowsePurcaseOrdersTable.header.table");
		browsePurcaseOrdersTable.setAutoResizeMode(AutoResizeMode.OFF);
		browsePurcaseOrdersTable.getSelectionValues();
		
		//add columns
		browsePurcaseOrdersTable.addColumn("label.po","po");
		browsePurcaseOrdersTable.addColumn("label.poDate","poDate");
		browsePurcaseOrdersTable.addColumn("label.dateExpected","dateExpected");
		browsePurcaseOrdersTable.addColumn("label.status","status");
		browsePurcaseOrdersTable.addColumn("label.dateClosed","dateClosed");
		browsePurcaseOrdersTable.addColumn("label.location","location");
		browsePurcaseOrdersTable.addColumn("label.vendor","vendor");
		browsePurcaseOrdersTable.addColumn("label.buyerName","buyerName");
		browsePurcaseOrdersTable.addColumn("label.shipVia","shipVia");
		browsePurcaseOrdersTable.addColumn("label.invoice","invoice");
		browsePurcaseOrdersTable.addColumn("label.order","order");
		
		//Sort
		browsePurcaseOrdersTable.sort("po", SortOrder.ASCENDING);
	}
	
	private void createLayout(){
		setLayout (new FormLayout())
		.addField(browsePurcaseOrdersTable);
	}

}
